using System;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;

public static class CheckInternetConnectivity
{
    public static bool CheckConnection(string ipString)
    {
        if (smethod_0())
        {
            bool flag;
            try
            {
                Ping ping = new Ping();
                if (ping.Send(ipString).Status == IPStatus.Success)
                {
                    flag = true;
                }
                else
                {
                    goto Label_0028;
                }
            }
            catch (Exception)
            {
                goto Label_0028;
            }
            return flag;
        }
    Label_0028:
        return false;
    }

    [DllImport("wininet", CharSet=CharSet.Auto)]
    private static extern bool InternetGetConnectedState(ref Enum0 enum0_0, int int_0);
    private static bool smethod_0()
    {
        Enum0 enum2 = (Enum0) 0;
        InternetGetConnectedState(ref enum2, 0);
        if ((((Enum0) 0x20) & enum2) != ((Enum0) 0))
        {
            return false;
        }
        return true;
    }

    private enum Enum0
    {
    }
}

